//
//  ViewController.m
//  3.7progress view
//
//  Created by h92 on 14/12/22.
//  Copyright (c) 2014年 李腾飞. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

@synthesize myActiveindiactor;
@synthesize myprogress;


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)download:(id)sender {
    if ([self.myActiveindiactor isAnimating]) {
        [self.myActiveindiactor stopAnimating];
    }else{
        [self.myActiveindiactor startAnimating];
    }
}

- (IBAction)upload:(id)sender {
    myTime=[NSTimer scheduledTimerWithTimeInterval:1.0
                                            target:self
                                          selector:@selector(uploads:)
                                          userInfo:nil
                                           repeats:YES];
}


-(void)uploads:(id)sender
{
    self.myprogress.progress=self.myprogress.progress+0.1;
    if (self.myprogress.progress==1.0) {
        [myTime invalidate];
        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"upload"
                                                     message:@""
                                                    delegate:self
                                           cancelButtonTitle:@"OK"
                                           otherButtonTitles:nil];
        [alert show];
    }
}

























@end
